package com.dtease.agent.core.page;

import lombok.Data;

/**
* @description 分页参数
* @author chentl
* @class PageParam
* @package com.dtease.agent.common.page
* @since 2025/5/14 13:07
*/
@Data
public class PageParam implements java.io.Serializable {
    private static final long serialVersionUID = 8189405713264758771L;

    /**
     * 当前页码
     */
    protected Integer currentPage;

    /**
     * 分页大小
     */
    protected Integer pageSize;

    /**
     * 排序字段
     */
    protected String sort;

    /**
     * 排序方式：（升序：ASC，降序：DESC）默认降序
     */
    protected String order;

    /**
     * 关键字
     */
    private String keyword;

    public Integer getCurrentPage() {
        if(currentPage == null || currentPage <= 0) {
            return 1;
        }
        return currentPage;
    }

    public Integer getPageSize() {
        if(pageSize == null || pageSize <= 0) {
            return 10;
        }
        return pageSize;
    }
}
